/*
 * Copyright (c) 2025 Industrial Software Feature Database
 */
package com.comac.ins.isfd.constant.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 业务类型，0-业务场景，1-业务系统
 *
 * @author hxloongs
 * @date 2025-2-28
 */
@AllArgsConstructor
@Getter
public enum IsfdBusinessScenariosTypeEnum {
    SCENE(0, "业务场景"),
    SYSTEM(1, "业务系统");
    private final Integer value;
    private final String desc;

    public static String getDescByValue(Integer value) {
        IsfdBusinessScenariosTypeEnum isfdBusinessScenariosTypeEnum = forValue(value);
        if (isfdBusinessScenariosTypeEnum == null) {
            return null;
        }
        return isfdBusinessScenariosTypeEnum.getDesc();
    }

    public static IsfdBusinessScenariosTypeEnum forValue(Integer value) {
        if (value == null) {
            return null;
        }
        for (IsfdBusinessScenariosTypeEnum isfdBusinessScenariosTypeEnum : IsfdBusinessScenariosTypeEnum.values()) {
            if (isfdBusinessScenariosTypeEnum.getValue().equals(value)) {
                return isfdBusinessScenariosTypeEnum;
            }
        }
        return null;
    }

    public static IsfdBusinessScenariosTypeEnum forDesc(String desc) {
        if (desc == null) {
            return null;
        }
        for (IsfdBusinessScenariosTypeEnum isfdBusinessScenariosTypeEnum : IsfdBusinessScenariosTypeEnum.values()) {
            if (desc.equals(isfdBusinessScenariosTypeEnum.getDesc())) {
                return isfdBusinessScenariosTypeEnum;
            }
        }
        return null;
    }
}
